package com.hubei.controller;


import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import com.hubei.pojo.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * @author WQ
 * @date 2025/6/29 10:09
 */
public class TestController implements Controller {

    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        ModelAndView mav = new ModelAndView();
        User user = new User(1,  "管理员", "男");
        // 将数据添加到模型视图中,最终在视图解析器中，会将逻辑视图中队的对象进行解析
        mav.addObject("attributeName", user);
        mav.setViewName("/WEB-INF/jsp/index.jsp");
        return mav;
    }
}